---
id: blur-parallax
title: Blur Parallax
sidebar_label: Blur Parallax
description: Blur Parallax animation
keywords:
  - custom-animations
  - blur-parallax
  - carousel animation
  - carousel animation blur-parallax
  - react-native-reanimated-carousel
  - reanimated-carousel
  - reanimated carousel
  - react-native
  - snap-carousel
  - react native
  - snap carousel
  - ios
  - android
  - carousel
  - snap
  - reanimated
image:
slug: /examples/custom-animations/blur-parallax
---

{/* 

=========================================================================
=========================================================================
This page generated by /scripts/gen-pages.mjs, Don't update it manually 
=========================================================================
=========================================================================

*/}

import { Tabs } from 'nextra/components'
import { Callout } from 'nextra/components'
import Demo from '@/components/Demo'

<Callout type="info" emoji="💡">
  Check out the `blur-parallax` animation demo for the full source code [here](https://github.com/dohooo/react-native-reanimated-carousel/blob/main/example/app/app/demos/custom-animations/blur-parallax/index.tsx)
</Callout>

<Demo kind="custom-animations" name="blur-parallax" />

```tsx copy
import * as React from "react";
import type { ImageSourcePropType } from "react-native";
import { Image, StyleSheet, View } from "react-native";
import Animated, {
	interpolate,
	useAnimatedStyle,
} from "react-native-reanimated";
import Carousel from "react-native-reanimated-carousel";

import { BlurView as _BlurView } from "expo-blur";

import { parallaxLayout } from "./parallax";

import SButton from "@/components/SButton";
import { SlideItem } from "@/components/SlideItem";
import { ElementsText, window } from "@/constants/sizes";
import { CaptureWrapper } from "@/store/CaptureProvider";
import { fruitItems } from "@/utils/items";

const BlurView = Animated.createAnimatedComponent(_BlurView);

const PAGE_WIDTH = window.width / 2;

function Index() {
	return (
		<View
			id="carousel-component"
			dataSet={{ kind: "custom-animations", name: "blur-parallax" }}
		>
			<Carousel
				loop={true}
				style={{
					width: window.width,
					height: 240,
					justifyContent: "center",
					alignItems: "center",
				}}
				width={PAGE_WIDTH}
				data={[...fruitItems, ...fruitItems]}
				renderItem={({ item, index, animationValue }) => {
					return (
						<CustomItem
							key={index}
							index={index}
							animationValue={animationValue}
						/>
					);
				}}
				customAnimation={parallaxLayout(
					{
						size: PAGE_WIDTH,
						vertical: false,
					},
					{
						parallaxScrollingScale: 1,
						parallaxAdjacentItemScale: 0.5,
						parallaxScrollingOffset: 40,
					},
				)}
				scrollAnimationDuration={1200}
			/>
		</View>
	);
}

interface ItemProps {
	index: number;
	animationValue: Animated.SharedValue<number>;
}
const CustomItem: React.FC<ItemProps> = ({ index, animationValue }) => {
	const maskStyle = useAnimatedStyle(() => {
		const opacity = interpolate(animationValue.value, [-1, 0, 1], [1, 0, 1]);

		return {
			opacity,
		};
	}, [animationValue]);

	return (
		<View
			style={{
				flex: 1,
				overflow: "hidden",
				justifyContent: "center",
				alignItems: "center",
				borderRadius: 10,
			}}
		>
			<View style={{ flex: 1, width: "100%" }}>
				<SlideItem index={index} rounded />
			</View>
			<BlurView
				intensity={50}
				pointerEvents="none"
				style={[StyleSheet.absoluteFill, maskStyle]}
			/>
		</View>
	);
};

export default Index;

```